<?php !defined('PATH_APP') && die('Forbidden!');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<link rel="Stylesheet" type="text/css" href="js/jmodal/jquery.jmodal.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jmodal/jquery.jmodal.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>IC 在线认证系统</title>
</head>
<style>

.content{
	width:300px;
	height:160px;
	background-color:#FFFFFF;
	border:4px solid #CCC;
	text-align:center;
	margin:auto;
}

.content h3{
	background-color:#2163ad;
	color:#FFFFFF;
	font-size:14px;
	margin:0px;
	padding:10px;
}
body{
	background-color:#EFEFEF;
	font-size:12px;
	margin-top:160px;
	font-family:Verdana, simsun;
}
form{
	margin: 10px;
}
</style>

<body >
<div class="content">
	<h3>IC 部门在线测试认证系统</h3>
  <div>
    <form id="form1" name="form1" method="post" action="" onsubmit="check_login(this);return false;">
      <table width="74%" border="0">
        <tr>
          <td width="24%">工号：</td>
          <td width="76%"><input name="employeenumber" type="text" id="employeenumber" /></td>
        </tr>
        <tr>
          <td>密码：</td>
          <td><input name="password" type="password" id="password" /></td>
        </tr>
        <tr>
          <td height="32" colspan="2" align="center"><input type="submit" name="Submit" value="进入考试"/></td>
        </tr>
      </table>
    </form>
  </div>
</div>
</body>
</html>
<script>
$("#employeenumber").focus();

function check_login(f){
	var employee_nr = f.employeenumber.value;
	var password = f.password.value;

	$.fn.jmodal({
		title: 'Information',
		content: function(e) {
			if(employee_nr == '' ){
				e.html('请输入您的工号');
				return;
			}
			if(password == '' ){
				e.html('请输入您的密码');
				return;
			}
			
			e.html('系统正在验证您的账户信息，请稍候...');
			
			$.getJSON("<?=_url('Index','Login')?>", {'employeenumber':employee_nr,'password':password},function(json){
				
				if(json.status == 1){
					e.html("登陆成功，正在转入试题信息页面");
					location.href="<?=_url('Exam','Select')?>";
				} else {
					e.html(json.info);
				}
			})
		},
		buttonText: { ok: '确定'},
		okEvent: function(obj, args) {
			args.complete();
		}
	});
}
</script>
